import 'package:get/get.dart';
import 'package:xindong/routes/call/controller/xindong_call_controller.dart';
import 'package:xindong/routes/call/model/xindong_call_volume_class.dart';

// 通话音量
class XinDongCallRTCVolumesController extends GetxController {
  static XinDongCallRTCVolumesController get to => Get.find();

  late XinDongCallVolumeClass mineClass;
  late XinDongCallVolumeClass targetClass;

  @override
  void onInit() {
    super.onInit();

    mineClass = XinDongCallVolumeClass(user: XinDongCallController.to.mineUser);
    targetClass = XinDongCallVolumeClass(user: XinDongCallController.to.targetUser);
  }

  // 重置音量
  void resetVolumes() {
    mineClass.volume = 0;
    targetClass.volume = 0;
  }

  // 更新
  void notifyUpdate() {
    if (XinDongCallController.to.status != XinDongCallStatus.active) {
      return;
    }
    update();
  }
}
